
package com.trydofor.id.exec;

import com.trydofor.id.doer.shell.ArgHelp;
import com.trydofor.id.doer.shell.Command;

/**
 * @author : Shi Rongjiu (www.trydofor.com)
 */
public final class SpringCmd {
    
    private SpringCmd() {
    }
    
    /**
     * load spring config
     * 
     * @return the command
     */
    public static Command loadConfig() {
        Command cmd = new Command("loadConfig", "load xml config file from classpath or system");
        ArgHelp arg = new ArgHelp("file");
        arg.setManual("the config file in classpath/system");
        arg.setRequired(true);
        cmd.addArgument(arg);
        return cmd;
    }
    
    /**
     * list names of the registered beans
     * 
     * @return the command
     */
    public static Command listBeans() {
        Command cmd = new Command("listBeans", "list the names of the registered beans");
        ArgHelp arg = new ArgHelp("pattern");
        arg.setManual("the fileter pattern");
        arg.setRequired(false);
        cmd.addArgument(arg);
        return cmd;
    }
    
    /**
     * remove the existed bean by name
     * 
     * @return the command
     */
    public static Command removeBean() {
        Command cmd = new Command("removeBean", "remove the existed bean by name");
        ArgHelp arg = new ArgHelp("name");
        arg.setManual("bean name");
        arg.setRequired(true);
        cmd.addArgument(arg);
        return cmd;
    }
    
    /**
     * remove the existed bean by name
     * 
     * @return the command
     */
    public static Command getBean() {
        Command cmd = new Command("getBean", "get the bean by name");
        ArgHelp arg = new ArgHelp("name");
        arg.setManual("bean name");
        arg.setRequired(true);
        cmd.addArgument(arg);
        return cmd;
    }
}
